import request from '@/utils/request'
import { makeFormData } from '@/utils/util'

const api = {
  psychologicalBehavior: 'eapi/operator/reports', // 心理行为评测
  sport: 'web/evaluate/page',
  childrenHealth: 'web/children_health/children_page', // 儿保评测
  psyAndBePublic: 'eapi/operator/finish_evaluate'
}

export function psychologicalBehavior (params = {}) {
  const { areaId, ...restParams } = params
  return request({
    url: api.psychologicalBehavior,
    method: 'post',
    params: { areaId },
    data: makeFormData(restParams)
  })
}

export function sport (params = {}) {
  const { areaId, ...restParams } = params
  return request({
    url: api.sport,
    method: 'post',
    params: { areaId },
    data: makeFormData(restParams)
  })
}

export function childrenHealth (params = {}) {
  const { areaId, ...restParams } = params
  return request({
    url: api.childrenHealth,
    method: 'post',
    params: { areaId },
    data: makeFormData(restParams)
  })
}

export function psyAndBePublic (data = {}) {
  return request({
    url: api.psyAndBePublic,
    method: 'post',
    data: makeFormData(data)
  })
}
